package com.cqut.forum.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author yangxun
 * UserLog entity
 */
@Entity
@Table(name = "user_log", catalog = "forum")
public class UserLog implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer userLogId;
	private User user;
	private Date userLogTime;
	private String userLogContents;

	// Constructors

	/** default constructor */
	public UserLog() {
	}

	/** full constructor */
	public UserLog(User user, Date userLogTime, String userLogContents) {
		this.user = user;
		this.userLogTime = userLogTime;
		this.userLogContents = userLogContents;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "user_log_id", unique = true, nullable = false)
	public Integer getUserLogId() {
		return this.userLogId;
	}

	public void setUserLogId(Integer userLogId) {
		this.userLogId = userLogId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "user_log_time", length = 10)
	public Date getUserLogTime() {
		return this.userLogTime;
	}

	public void setUserLogTime(Date userLogTime) {
		this.userLogTime = userLogTime;
	}

	@Column(name = "user_log_contents", length = 200)
	public String getUserLogContents() {
		return this.userLogContents;
	}

	public void setUserLogContents(String userLogContents) {
		this.userLogContents = userLogContents;
	}

}